package com.example.kafka.comsumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author feina
 * @Title: Consumer.java
 * @Package com.example.kafka.comsumer
 * @Description 简单消费
 * @date 2023/4/23 15:48
 * @Copyright
 */
@Component
public class Consumer {
    @KafkaListener(topics = "test")
    public void receive(ConsumerRecord<?, ?> record) {
        // 消费的哪个topic、partition的消息,打印出消息内容
        System.out.println("简单消费：" + record.topic() + "-" + record.partition() + "-" + record.value());
    }
}
